<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: faiss::gpu::GpuResources Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacefaiss.html">faiss</a></li><li class="navelem"><b>gpu</b></li><li class="navelem"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html">GpuResources</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classfaiss_1_1gpu_1_1GpuResources-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">faiss::gpu::GpuResources Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="GpuResources_8h_source.html">GpuResources.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for faiss::gpu::GpuResources:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classfaiss_1_1gpu_1_1GpuResources.png" usemap="#faiss::gpu::GpuResources_map" alt=""/>
  <map id="faiss::gpu::GpuResources_map" name="faiss::gpu::GpuResources_map">
<area href="classfaiss_1_1gpu_1_1StandardGpuResources.html" alt="faiss::gpu::StandardGpuResources" shape="rect" coords="0,56,205,80"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a1f7f4e220ce279257e1daf929c3b0d4e"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#a1f7f4e220ce279257e1daf929c3b0d4e">initializeForDevice</a> (int device)=0</td></tr>
<tr class="separator:a1f7f4e220ce279257e1daf929c3b0d4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa2682b8503dfdab4f7f5ef867035ad29"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa2682b8503dfdab4f7f5ef867035ad29"></a>
virtual cublasHandle_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#aa2682b8503dfdab4f7f5ef867035ad29">getBlasHandle</a> (int device)=0</td></tr>
<tr class="memdesc:aa2682b8503dfdab4f7f5ef867035ad29"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the cuBLAS handle that we use for the given device. <br/></td></tr>
<tr class="separator:aa2682b8503dfdab4f7f5ef867035ad29"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c564198df6ba675920c993e2af34b8c"><td class="memItemLeft" align="right" valign="top">virtual cudaStream_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#a6c564198df6ba675920c993e2af34b8c">getDefaultStream</a> (int device)=0</td></tr>
<tr class="separator:a6c564198df6ba675920c993e2af34b8c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb469bf3b107f43ef0d6abe4a014bb5b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afb469bf3b107f43ef0d6abe4a014bb5b"></a>
virtual std::vector&lt; cudaStream_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#afb469bf3b107f43ef0d6abe4a014bb5b">getAlternateStreams</a> (int device)=0</td></tr>
<tr class="memdesc:afb469bf3b107f43ef0d6abe4a014bb5b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the set of alternative streams that we use for the given device. <br/></td></tr>
<tr class="separator:afb469bf3b107f43ef0d6abe4a014bb5b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7fec58e9414f313fde4988a62f06cfab"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7fec58e9414f313fde4988a62f06cfab"></a>
virtual <a class="el" href="classfaiss_1_1gpu_1_1DeviceMemory.html">DeviceMemory</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#a7fec58e9414f313fde4988a62f06cfab">getMemoryManager</a> (int device)=0</td></tr>
<tr class="memdesc:a7fec58e9414f313fde4988a62f06cfab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the temporary memory manager for the given device. <br/></td></tr>
<tr class="separator:a7fec58e9414f313fde4988a62f06cfab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad1b018745239e03d0044b659335c17a8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad1b018745239e03d0044b659335c17a8"></a>
virtual std::pair&lt; void *, size_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#ad1b018745239e03d0044b659335c17a8">getPinnedMemory</a> ()=0</td></tr>
<tr class="memdesc:ad1b018745239e03d0044b659335c17a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the available CPU pinned memory buffer. <br/></td></tr>
<tr class="separator:ad1b018745239e03d0044b659335c17a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a104b291ed4116033752144e90856c2e7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a104b291ed4116033752144e90856c2e7"></a>
virtual cudaStream_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#a104b291ed4116033752144e90856c2e7">getAsyncCopyStream</a> (int device)=0</td></tr>
<tr class="memdesc:a104b291ed4116033752144e90856c2e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the stream on which we perform async CPU &lt;-&gt; GPU copies. <br/></td></tr>
<tr class="separator:a104b291ed4116033752144e90856c2e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00cb7bcbc5f1a00da673f30749149b12"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a00cb7bcbc5f1a00da673f30749149b12"></a>
cublasHandle_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#a00cb7bcbc5f1a00da673f30749149b12">getBlasHandleCurrentDevice</a> ()</td></tr>
<tr class="memdesc:a00cb7bcbc5f1a00da673f30749149b12"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calls getBlasHandle with the current device. <br/></td></tr>
<tr class="separator:a00cb7bcbc5f1a00da673f30749149b12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa0354aa570c24e17a9f8a6a45b153ed2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa0354aa570c24e17a9f8a6a45b153ed2"></a>
cudaStream_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#aa0354aa570c24e17a9f8a6a45b153ed2">getDefaultStreamCurrentDevice</a> ()</td></tr>
<tr class="memdesc:aa0354aa570c24e17a9f8a6a45b153ed2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calls getDefaultStream with the current device. <br/></td></tr>
<tr class="separator:aa0354aa570c24e17a9f8a6a45b153ed2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a130deab9f6d49cbdde8f9da45ce868fd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#a130deab9f6d49cbdde8f9da45ce868fd">syncDefaultStream</a> (int device)</td></tr>
<tr class="separator:a130deab9f6d49cbdde8f9da45ce868fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adf6a5653ec2bbb0e9d58a0e1dd73897f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adf6a5653ec2bbb0e9d58a0e1dd73897f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#adf6a5653ec2bbb0e9d58a0e1dd73897f">syncDefaultStreamCurrentDevice</a> ()</td></tr>
<tr class="memdesc:adf6a5653ec2bbb0e9d58a0e1dd73897f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calls syncDefaultStream for the current device. <br/></td></tr>
<tr class="separator:adf6a5653ec2bbb0e9d58a0e1dd73897f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a622f95597cc2ed2f10f3ae9400dc685b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a622f95597cc2ed2f10f3ae9400dc685b"></a>
std::vector&lt; cudaStream_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#a622f95597cc2ed2f10f3ae9400dc685b">getAlternateStreamsCurrentDevice</a> ()</td></tr>
<tr class="memdesc:a622f95597cc2ed2f10f3ae9400dc685b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calls getAlternateStreams for the current device. <br/></td></tr>
<tr class="separator:a622f95597cc2ed2f10f3ae9400dc685b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1dda2dc3db1bd62cde6657c5cdbfb6e1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1dda2dc3db1bd62cde6657c5cdbfb6e1"></a>
<a class="el" href="classfaiss_1_1gpu_1_1DeviceMemory.html">DeviceMemory</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#a1dda2dc3db1bd62cde6657c5cdbfb6e1">getMemoryManagerCurrentDevice</a> ()</td></tr>
<tr class="memdesc:a1dda2dc3db1bd62cde6657c5cdbfb6e1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calls getMemoryManager for the current device. <br/></td></tr>
<tr class="separator:a1dda2dc3db1bd62cde6657c5cdbfb6e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aefb90d15fade57cdfcff03ec800183d4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aefb90d15fade57cdfcff03ec800183d4"></a>
cudaStream_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classfaiss_1_1gpu_1_1GpuResources.html#aefb90d15fade57cdfcff03ec800183d4">getAsyncCopyStreamCurrentDevice</a> ()</td></tr>
<tr class="memdesc:aefb90d15fade57cdfcff03ec800183d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calls getAsyncCopyStream for the current device. <br/></td></tr>
<tr class="separator:aefb90d15fade57cdfcff03ec800183d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Base class of GPU-side resource provider; hides provision of cuBLAS handles, CUDA streams and a temporary memory manager </p>

<p>Definition at line <a class="el" href="GpuResources_8h_source.html#l00021">21</a> of file <a class="el" href="GpuResources_8h_source.html">GpuResources.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a6c564198df6ba675920c993e2af34b8c"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual cudaStream_t faiss::gpu::GpuResources::getDefaultStream </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>device</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns the stream that we order all computation on for the given device </p>

<p>Implemented in <a class="el" href="classfaiss_1_1gpu_1_1StandardGpuResources.html#a954f34ef68fd36b8d502ca3a21f7e8a8">faiss::gpu::StandardGpuResources</a>.</p>

</div>
</div>
<a class="anchor" id="a1f7f4e220ce279257e1daf929c3b0d4e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void faiss::gpu::GpuResources::initializeForDevice </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>device</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Call to pre-allocate resources for a particular device. If this is not called, then resources will be allocated at the first time of demand </p>

<p>Implemented in <a class="el" href="classfaiss_1_1gpu_1_1StandardGpuResources.html#adb2729678638ed89f7b8b38470f96056">faiss::gpu::StandardGpuResources</a>.</p>

</div>
</div>
<a class="anchor" id="a130deab9f6d49cbdde8f9da45ce868fd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::gpu::GpuResources::syncDefaultStream </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>device</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Synchronizes the CPU with respect to the default stream for the given device </p>

<p>Definition at line <a class="el" href="GpuResources_8cpp_source.html#l00043">43</a> of file <a class="el" href="GpuResources_8cpp_source.html">GpuResources.cpp</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/data/users/hoss/faiss/gpu/<a class="el" href="GpuResources_8h_source.html">GpuResources.h</a></li>
<li>/data/users/hoss/faiss/gpu/<a class="el" href="GpuResources_8cpp_source.html">GpuResources.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
